<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>采购入库 - 仓库管理系统</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;top: 0px;">
    <style type="text/css">
        .record-box {
            position: relative;
            width: 700px;
            padding: 0 5px 20px;
            font-size: 13px;
            color: #787878;
        }

        .record-box h2 {
            font-weight: bold;
            font-size: 18px;
            margin-bottom: 40px;
        }

        .record-input, .record-tips {
            width: 320px;
            margin: 0 auto;
            text-align: left;
        }

        .record-input input {
            width: 400px;
            height: 22px;
            line-height: 22px;
            font-size: 16px;
            padding: 14px 9px;
            border: 1px solid #787878;
        }

        .record-tips {
            padding: 5px 0;
            color: #f00;
            font-size: 13px;
            line-height: 2;
        }
    </style>
    <!-- start sp-wrapper -->
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="sp-wrapper">
        <h2 class="sp-title"><a class="active">待入库</a> <a href="/stock_in/purchase_put">已入库</a></h2>
        <div class="sp-tool">
            <span class="fl">
                <form action="/stock_in/purchase_list" method="get">
                <b><input type="text" id="billNo" name="billNo" onfocus="this.value='';" autocomplete="off"
                          th:value="${billNo}" placeholder="输入单据编号查询"></b>
                <b>单据日期：
                    <input type="text" name="startDate" autocomplete="off" th:value="${startDate}" class="date"> -
                    <input type="text" th:value="${endDate}" name="endDate" class="date" autocomplete="off">
                    <input type="submit" class="button" value="查询"></b>
                </form>
            </span>

            <span class="fr">
<!--                <a href="/purchase/add" class="add">新增采购单</a>-->
                <!--                <i id="saomaoruku">扫码入库</i>-->
            </span>
        </div>
        <div class="sp-table">

            <table>
                <thead>
                <tr>
                    <th>单据日期</th>
                    <th>单据编号</th>
                    <th>供应商</th>

                    <th>制单人</th>
                    <th>合格数量</th>
                    <th>已入库数量</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody id="sp-data">
                <tr th:each="item:${list}">
                    <td th:text="${item.billDate}">2019-03-15</td>
                    <td th:text="${item.billNo}">CG201903121700193</td>
                    <td th:text="${item.contactName}">华衣</td>

                    <td th:text="${item.userName}">华衣</td>
                    <td th:text="${item.qualifiedQuantity}">500</td>
                    <td th:text="${item.inQuantity}">500</td>
                    <td th:text="${T(com.b2c.entity.erp.enums.InvoiceBillStatusEnum).getName(item.billStatus)}">华衣</td>
                    <td>
                        <!--                            <i class="stockin" th:attr="data-id=${item.id}">入库</i>-->
                        <a th:href="${'/stock_in/purchase_detail?id='+item.id}" target="_blank">入库</a>

                    </td>
                </tr>

                </tbody>
            </table>

        </div>
        <div class="pages">
            <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
        </div>
    </div>

    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>
    <script type="text/javascript">
        $(function () {

            $("#billNo").focus();

        });
    </script>
    <!-- end sp-wrapper -->
    <script>
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            var layer = layui.layer;
            //执行一个laydate实例
            laydate.render({
                elem: '.date' //指定元素
            });


            $(".stockin").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                //iframe层

                layer.open({
                    type: 2,
                    title: '采购单入库',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['880px', '90%'],
                    content: '/stock_in/purchase_detail?id=' + id //iframe的url
                });
            })

            $("#saomaoruku").click(function () {
                var html = '\t<div class="record-box">\n' +
                    '\t\t<h2>请扫描采购单条形码</h2>\n' +
                    '<form action="/stock_in/purchase_detail" method="get" target="_blank">' +
                    '\t\t<div class="record-input">\n' +

                    '\t\t\t<input type="text" name="billNo" autocomplete="off" />\n' +
                    '\t\t</div>\n' +
                    '\t\t<div class="record-input">\n' +
                    '<input type="submit" value="查询" />' +
                    '\t\t</div>\n' +
                    '</form>' +
                    '\t\t<div class="record-tips">错误提示</div>\n' +
                    '\t</div>';
                // layer.open({
                //         type: 1,
                //         skin: 'layui-layer-rim', //加上边框
                //         area: ['730px', '340px'], //宽高
                //         content: html//'<form action="/stock_in/purchase_detail" method="get" target="_blank"><input name="billNo" autocomplete="off" type="text" /><input type="submit" value="查询" /></form>'
                //     });
                layer.open({
                    type: 2,
                    title: '扫码入库',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['580px', '400px'],
                    content: '/stock_in/purchase_detail_qrcode' //iframe的url
                });

            })

        });
    </script>
</div>
</body>
<html>
